package com.dcy.mediator;

/**
 * @Author：dcy
 * @Description:
 * @Date: 2021/1/29 13:39
 */
public class Client {
    public static void main(String[] args) {
        //创建一个中介者对象
        Mediator mediator = new ConcreteMediator();
        //创建 Alarm并且加入到     ConcreteMediator对象的   HashMap
        Alarm alarm = new Alarm(mediator, "alarm");
        //创建了 CoffeeMachine对象，并且加入到        ConcreteMediator对象的    HashMap
        CoffeeMachine coffeeMachine = new CoffeeMachine(mediator,
                "coffeeMachine");
        //创建  Curtains ,并且加入到        ConcreteMediator对象的    HashMap
        Curtains curtains = new Curtains(mediator, "curtains");
        TV tV = new TV(mediator, "TV");
        //让闹钟发出消息
        alarm.sendAlarm(0);
        coffeeMachine.finishCoffee();
        alarm.sendAlarm(1);

    }
}
